package cn.quevo.cube.provide.define.service.impl;

import cn.quevo.common.entity.PageResult;
import cn.quevo.cube.provide.define.dao.CubeDbDao;
import cn.quevo.cube.provide.define.entity.CubeDb;
import cn.quevo.cube.provide.define.entity.query.CubeDbQuery;
import cn.quevo.cube.provide.define.service.CubeDbService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.Map;

/**
 * 模型数据库 Service接口实现
 *
 * @author July july_sky@foxmail.com
 * @version 1.0
 * @date 2018/12/11 14:57:24
 * @Copyright 东方浩星（北京）传媒科技有限公司版权所有.All Rights Reserved.
 */
@Service("cubeDbService")
@Transactional(transactionManager="transactionManager",rollbackFor={Exception.class})
public class CubeDbServiceImpl implements CubeDbService {
    @Resource(name="cubeDbDao")
    private CubeDbDao cubeDbDao;

    @Override
    public Map<String,Object> getSinge(CubeDbQuery cubeDbQuery) {
        return this.cubeDbDao.getSinge(cubeDbQuery);
    }

    @Override
    public Integer create(CubeDb cubeDb) {
        cubeDb.validateCreate();
        return this.cubeDbDao.create(cubeDb);
    }

    @Override
    public Integer update(CubeDb cubeDb) {
        cubeDb.validateUpdate();
        return this.cubeDbDao.update(cubeDb);
    }

    @Override
    public PageResult<Map<String,Object>> getPage(CubeDbQuery cubeDbQuery) {
        return this.cubeDbDao.getPage(cubeDbQuery);
    }
}
